package acn.spring.shop.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import acn.spring.service.ShopService;

@Controller
@RequestMapping("/home")
public class HomeController extends BaseCategoryController {

	@Autowired
	public HomeController(ShopService shopService) {
		super(shopService);
	}

	@ModelAttribute
	public void populateTopFiveBestSeller(Model model) {
		model.addAttribute(getShopService().findTopFiveBestSeller());
	}

	@RequestMapping
	public String home() {
		return "home";
	}

}
